package com.baize.baizeapp.test.video

import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import com.baize.baizeapp.R

class PreVideoActivity : AppCompatActivity() {

    companion object {
        fun open(context: Context) {
            val intent = Intent(context, PreVideoActivity::class.java)
            context.startActivity(intent)
        }
    }

    val testConerUrl = "https://img.heishiapp.com/jZT9YDkw31u1FNb7bgWXd0pYg3I=/Fs-gt3q_JAldzjEXOi2HXZdvHUXM-origin"
    val testVideoUrl = "https://img.heishiapp.com/Fs-gt3q_JAldzjEXOi2HXZdvHUXM"

    lateinit var preVideoView:HSPreVideoView
    lateinit var preVideoView2:HSPreVideoView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_pre_video)
        preVideoView = findViewById(R.id.preVideoView)
        preVideoView2 = findViewById(R.id.preVideoView2)
        preVideoView.initVideo(testVideoUrl,testConerUrl)
        preVideoView2.initVideo(testVideoUrl,testConerUrl)
    }

    fun attachVideo(v: View) {
        VideoPlayerManager.attachToPreVideo(preVideoView)
    }

    fun attachVideo2(v: View) {
        VideoPlayerManager.attachToPreVideo(preVideoView2)
    }

    fun isAttach(v: View) {
        Log.i("yanze","isAttach:${VideoPlayerManager.isAttach()}")
    }

    fun removeVideo(v: View) {
        VideoPlayerManager.removeAttach()
    }

}